package com.augurit.common.base.extmodel.inner;

import javax.servlet.http.HttpServletRequest;

import com.augurit.common.base.extmodel.base.BaseTreeNode;

/**
 * 机构人员树（Ext扩展组件）的java类
 */
public class OrgTreeNode extends BaseTreeNode<OrgTreeNode> {
	
	// ****************** 静态属性 ******************
	// 机构人员树的各类节点的图标CSS
	public static final String CLS_ORG = "icon-org";
	public static final String CLS_WORKGROUP = "icon-workgroup";
	public static final String CLS_POSITION = "icon-position";
	public static final String CLS_USER_MALE = "icon-user-male";
	public static final String CLS_USER_FEMALE = "icon-user-female";
	
	/**
	 * 根据Request参数构造OrgTreeNode对象
	 * @param request
	 * @return
	 */
	public static OrgTreeNode build(HttpServletRequest request){
		OrgTreeNode node = new OrgTreeNode();
		node.setPartyType(request.getParameter("partyType"));
		
		String orgIdStr = request.getParameter("orgId");
		node.setOrgId(orgIdStr != null && orgIdStr.trim().length() > 0 ? Long.valueOf(orgIdStr) : null);
		
		String posIdStr = request.getParameter("posId");
		node.setPosId(posIdStr != null && posIdStr.trim().length() > 0 ? Long.valueOf(posIdStr) : null);
		
		String userIdStr = request.getParameter("userId");
		node.setUserId(userIdStr != null && userIdStr.trim().length() > 0 ? Long.valueOf(userIdStr) : null);
		
		return node;
	}
	
	private String partyType;
	private Long orgId;				//机构ID
	private Long posId;				//岗位ID
	private Long userId;			//用户ID
	private boolean isCanManager;	//是否有有该节点的右键菜单权限和左键单击权限
	

	// ****************** getter和setter方法 ******************
	public String getPartyType() {
		return partyType;
	}

	public void setPartyType(String partyType) {
		this.partyType = partyType;
	}

	public Long getOrgId() {
		return orgId;
	}

	public void setOrgId(Long orgId) {
		this.orgId = orgId;
	}

	public Long getPosId() {
		return posId;
	}

	public void setPosId(Long posId) {
		this.posId = posId;
	}

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public boolean isCanManager() {
		return isCanManager;
	}

	public void setCanManager(boolean isCanManager) {
		this.isCanManager = isCanManager;
	}

	
}
